﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseSet.Data;
using BaseSet.Logic;
using BaseSet.Entity;
using BaseSet.Framework;
using BaseSet.Entity.Common;
using BaseSet.Entity.Common.Text;
using BaseSet;
using System.Data;

namespace WebSite.Admin.SystemSet
{
    public partial class AdminRoleAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        #region 添加
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string roleid = txtRoleID.Text.Trim();
            string rolename = txtRoleName.Text.Trim();

            if (string.IsNullOrEmpty(roleid))
            {
                Tools.Alert("请填写权限ID！");
                return;
            }

            if (string.IsNullOrEmpty(rolename))
            {
                Tools.Alert("请填写权限名称！");
                return;
            }

            Role rinfo = new Role();
            RoleHelper rhelper = new RoleHelper();
            rinfo.ID = roleid;
            rinfo.RoleName = rolename;
            rinfo.RoleType = 0;
            rhelper.AddRole(rinfo);

            Tools.AlertAndRedirect("添加成功！", "AdminRoleList.aspx");
        }
        #endregion

        #region 返回
        protected void ReturnBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminRoleList.aspx");
        }
        #endregion
    }
}